﻿using System.Collections.Specialized;
using System.Xml;
using SqlMapper.SqlElements;

namespace SqlMapper.Serializers
{
    public sealed class IsNullDeSerializer : IDeSerializer
    {
        public BaseTag Deserialize(XmlNode node)
        {
            IsNull isNull = new IsNull();

            NameValueCollection prop = NodeUtils.ParseAttributes(node);
            isNull.Prepend = NodeUtils.GetStringAttribute(prop, "prepend");
            isNull.Property = NodeUtils.GetStringAttribute(prop, "property");
            isNull.Sql = NodeUtils.GetStringAttribute(prop, "sql");

            return isNull;
        }
    }
}
